import re
beginRegex=re.compile(r'^hello')
mo=beginRegex.search('hello world')
mo1=beginRegex.search('world hello')

atRegex=re.compile(r'.at')
mo2=atRegex.findall('the cat in THE hat Sat on the flat mat')

nameRegex=re.compile(r'First name: (.*) Last name: (.*)')
mo3=nameRegex.search('First name: AI Last name: Sweet')

nongreedyRegex=re.compile(r'<.*?>')
mo4=nongreedyRegex.search('<to server man> for dinner>')

greedRegex=re.compile(r'<.*>')
mo5=greedRegex.search('<to server man> for dinner>')

nameRegex=re.compile(r'Agent \w+')
mo6=nameRegex.sub('CENSORED','Agent Alice gave the secret document to Agent Bob')

anentRegex=re.compile(r'Agent (\w)(\w)\w*')
mo7=anentRegex.sub(r'\1****','Agent Alice told Agent Carol that Agent')
